package com.mybatis.demo.service.impl;

import com.mybatis.demo.dao.IAttendanceMapper;
import com.mybatis.demo.domain.Attendence;
import com.mybatis.demo.service.AttendanceService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.sql.Date;
import java.util.List;

@Service
public class AttendanceServiceImpl implements AttendanceService {
    @Autowired
    private IAttendanceMapper iAttendanceMapper;

    @Override
    public int InsertAttendenceBydate(Attendence attendence) {
        return iAttendanceMapper.InsertAttendenceBydate(attendence);
    }

    @Override
    public List<Attendence> SearchAttendence(Long page, Long size, String name, Date date) {
        return iAttendanceMapper.SearchAttendence( (page-1)*size,size,name,date);
    }

    @Override
    public int count(String name,Date date) {
        return iAttendanceMapper.count(name,date);
    }

    @Override
    public int delById(Long recordId) {
        return iAttendanceMapper.delById( recordId);
    }

    @Override
    public int UpdateAttendence(Attendence attendence) {
        System.out.println(attendence);
        return iAttendanceMapper.UpdateAttendence(attendence);
    }

    @Override
    public List<Attendence> SearchAttendenceBystuId(Long page, Long size, Long studentId, Date date) {
        return iAttendanceMapper.SearchAttendenceBystuId( (page-1)*size,size,studentId,date);
    }

    @Override
    public int countById(Long id) {
        return iAttendanceMapper.countById(id);
    }
}
